class MyRangeIterator:
    def __init__(self, data):
        self.__data = data
        self.__count = 0

    def __next__(self):
        if self.__data == self.__count:
            raise StopIteration
        __item = self.__count
        self.__count += 1
        return __item


class MyRange:
    def __init__(self, data):
        self.__data = data

    def __iter__(self):
        return MyRangeIterator(self.__data)


class MyRange2:
    def __init__(self, data):
        self.__data = data

    def __iter__(self):
        begin = 0
        while self.__data > begin:
            yield begin
            begin += 1


for item in MyRange2(5):
    print(item)
